﻿<phone:PhoneApplicationPage
    x:Class="strillone.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"    
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False">


    <phone:PhoneApplicationPage.Resources>
        <Style x:Key="CustomButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
            <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
            <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Margin" Value="0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneForegroundBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <ContentPresenter VerticalAlignment="Stretch">
                                <Border x:Name="ButtonBackground" Background="{TemplateBinding Background}" CornerRadius="0" Margin="0">
                                    <ContentControl x:Name="ContentContainer" Content="{TemplateBinding Content}"/>
                                </Border>
                            </ContentPresenter>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot è la griglia radice in cui viene inserito tutto il contenuto della pagina-->
    <Grid x:Name="ContentUI" Background= "#ffffff" Margin="0" >

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>


        <Button Name="alto_sin" Grid.Row="0" Grid.Column="0" Background="#03b8ff" Tap="ButtonAltoSin_Click" Hold="alto_sin_Hold" Style="{StaticResource CustomButtonStyle}">
            <Image Source="{Binding BestResolutionImageButtonHome, Source={StaticResource MultiResImageChooser}}" Stretch="None"/>
        </Button>

        <Button Name="basso_sin" Grid.Row="1" Grid.Column="0"  Background="#0072aa" Tap="ButtonBassoSin_Click" Hold="basso_sin_Hold" Style="{StaticResource CustomButtonStyle}" >
            <Image Source="{Binding BestResolutionImageButtonEnter, Source={StaticResource MultiResImageChooser}}" Stretch="None"/>
        </Button>

        <Button Name="alto_dex" Grid.Row="0" Grid.Column="1"  Background="#00a7fb" Tap="ButtonAltoDex_Click" Hold="alto_dex_Hold" Style="{StaticResource CustomButtonStyle}">
            <Image Source="{Binding BestResolutionImageButtonUp, Source={StaticResource MultiResImageChooser}}" Stretch="None"/>
        </Button>

        <Button Name="basso_dex" Grid.Row="2" Grid.Column="2" Background="#008dd3" Tap="ButtonBassoDex_Click" Style="{StaticResource CustomButtonStyle}">
            <Image Source="{Binding BestResolutionImageButtonDown, Source={StaticResource MultiResImageChooser}}" Stretch="None"/>
        </Button>

        <StackPanel Name="marchio" Grid.RowSpan="5" Grid.ColumnSpan="5" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center">
            <Image Source="{Binding BestResolutionImage, Source={StaticResource MultiResImageChooser}}" Stretch="None"/>
        </StackPanel>
        
        <StackPanel  Name="loadingPanel"  Orientation="Vertical" Grid.Row="2" Grid.ColumnSpan="5" Background="Transparent" Height="50" Width="450" HorizontalAlignment="Center" Visibility="Visible" Margin="0,270,0,70">
            <TextBlock Name="tbox" FontSize="25" Foreground="White"  TextAlignment="Center" />
            <ProgressBar Name="progressBar1" FlowDirection="LeftToRight" IsIndeterminate="True" Visibility="Collapsed" Foreground="White" Width="300" Height="20" />
        </StackPanel>

        <StackPanel  Name="loadingPanel1"  Orientation="Vertical" Grid.Row="2" Grid.ColumnSpan="5" Background="Transparent" Height="50" Width="450" HorizontalAlignment="Center" Visibility="Visible" Margin="0,270,0,70">
            <TextBlock Name="tbox1" Text="Inizializzazione avvenuta con successo" FontSize="25" Foreground="White"  TextAlignment="Center" Visibility="Collapsed" />
        </StackPanel>
        
        <MediaElement x:Name="myClickSound" Source="Assets\Sounds\jingle.mp3" AutoPlay="True" Visibility="Collapsed"></MediaElement>


    </Grid>


</phone:PhoneApplicationPage>

    
    

    
    